package server.conn.admin;

import java.io.IOException;
import java.net.SocketTimeoutException;

import server.Logger;
import server.conn.ConnectionController;

public class AdminConnectionController extends ConnectionController {
	
	/**
	 * Constructor for AdminConectionController
	 * @param port	Port to listen for connection on
	 */
	public AdminConnectionController(int port) {
		super (port,"AdminConnectionController");
	}
	
	/**
	 * Begin listening for incoming connections
	 */
	protected void listen() {
		listening = true;
		while (listening) {
        	try {
        		new AdminThread(serverSocket.accept(), this, connections).start();
        	} catch (SocketTimeoutException e) {
        		// just so the loop checks to see if listening is false
        	} catch (IOException e) {
				Logger.getInstance().addError("IO exception in "+name, 2);
				listening = false;
			}
        }
	}
}
